import java.util.Arrays;
import java.util.Scanner;

//题目：有n个整数，使其前面各数顺序向后移m个位置，最后m个数变成最前面的m个数
public class Test36 {
    public static void main(String[] args) {
        Scanner console = new Scanner(System.in);
        System.out.println("请输入n:");
        int n = console.nextInt();
        System.out.println("请输入m:");
        int m = console.nextInt();
        pushArr(n, m);
    }

    public static void pushArr(int n, int m) {
        int[] arr = new int[n];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = (int) (Math.random() * 100);
        }
        System.out.println(Arrays.toString(arr));
        int[] brr = new int[n];
        System.arraycopy(arr, arr.length - m, brr, 0, m);
        System.arraycopy(arr, 0, brr, m, arr.length - m);
        System.out.println(Arrays.toString(brr));
    }
}